#ifndef __UPPER_H__
#define __UPPER_H__

#include "common.h"
#include "user.h"

#define RETURN_MESSAGE_LENGTH       128

#define ERROR_UPPER_BASE 300

enum UPPER_ERROR{
    ERROR_PARSE_JSON = ERROR_UPPER_BASE+1,
};

typedef struct _upper_protocol{
    int id;
    int returnCode;
    int returnMessage[RETURN_MESSAGE_LENGTH];
    void* param;
} upper_protocol;

char* parse_upper_protocol(char* data,user_socket* user);
cJSON* response_packet(int id,int return_code,cJSON* param,int time);
char* request_packet(int id,cJSON* param);

#endif // !__PROTOCOL_JSON__
